import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { resolve } from 'path' // 引入一次即可
// import AutoImport from 'unplugin-auto-import/vite'
// import Components from 'unplugin-vue-components/vite'
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'


export default defineConfig({
    plugins: [vue(),
        // AutoImport({
        //     resolvers: [ElementPlusResolver()],
        // }),
        // Components({
        //     resolvers: [ElementPlusResolver()],
        // }),
    ],
    lintOnSave: false,
    base: './', // 根路径配置
    server: {
        host: '0.0.0.0',
        port: 5051, // 端口配置
        open: true,
        hmr: {
            overlay: false
        }
    },
    resolve: {
        alias: {
            '@': resolve(__dirname, 'src'), // 别名配置
            'components': resolve(__dirname, './src/components'),
            'assets': resolve(__dirname, './src/assets'),
            '#': resolve(__dirname, 'types'),
            'build': resolve(__dirname, 'build') // 键值对的键不需要引号
        },
        extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', 'csv'],
    },
})